#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n; cin >> n;
	vector<int> a(2 * n);
	for (int i = 0; i < 2 * n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	for (int i = 1; i < 2 * n; i += 2) {
		if (a[i] != a[i - 1]) {
			cout << -1 << endl;
			return 0;
		}
	}
	for (int j = 0; j < 2; j++) {
		for (int i = 0; i < 2 * n; i += 2) cout << a[i] << " ";
		cout << endl;
	}
	return 0;
}